﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="Employee.aspx.cs" Inherits="WebApplication5.Pages.Employee" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContainerPlaceHolder" runat="server">
	<form id="form1" runat="server">
		<div class="panel-group" id="accordion">
			<div class="panel panel-default">
				<a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">
					<div class="panel-heading">
						<h4 class="panel-title">Opret Ansat
						</h4>
					</div>
				</a>
				<div id="collapseTwo" class="panel-collapse collapse">
					<div class="panel-body">

								<span class="form-label">Firma Nr</span>
                                <asp:TextBox ID="companyTb" CssClass="form-control" runat="server"> </asp:TextBox>
								
                                <span class="form-label">Fornavn</span>
				                <asp:TextBox ID="firstnameTb" CssClass="form-control" runat="server"> </asp:TextBox>


								<span class="form-label">efternavn</span>
								<asp:TextBox ID="lastnameTb" CssClass="form-control" runat="server"> </asp:TextBox>

								<span class="form-label">Telefon nr</span>
								<asp:TextBox ID="phoneNumberTb" CssClass="form-control" runat="server"> </asp:TextBox>

								<span class="form-label">brugernavn</span>
								<asp:TextBox ID="usernameTb" CssClass="form-control" runat="server"> </asp:TextBox>

								<span class="form-label">kodeord</span>
								<asp:TextBox ID="passwordTb" CssClass="form-control" runat="server"> </asp:TextBox>

                        <asp:Button CssClass="btn btn-success btn-lg" ID="buttonCreate" OnClick="ButtonAdd_Click" Text="Opret" runat="server" />
					</div>
				</div>
			</div>
			<div class="panel panel-default">
				<a data-toggle="collapse" data-parent="#accordion" href="#collapseThree">
					<div class="panel-heading">
						<h4 class="panel-title">Ret Ansat
						</h4>
					</div>
				</a>
				<div id="collapseThree" class="panel-collapse collapse">
					<div class="panel-body">
						<asp:ScriptManager ID="ScriptManager2" runat="server" />
						<asp:UpdatePanel runat="server" ID="UpdatePanel2" UpdateMode="Conditional">
							<ContentTemplate>
								<Triggers>
									<asp:AsyncPostBackTrigger ControlID="UpdateButton1" EventName="Click" />
								</Triggers>
							
								<asp:DropDownList ID="DropDownListEdit" runat="server" CssClass="form-control"></asp:DropDownList>

								<asp:Button ID="UpdateButton1" CssClass="btn btn-warning" runat="server" Text="Hent Ansat" OnClick="ButtonGetEmployee_Click" /><br />

								<span class="form-label">Firma Nr:</span>
								<asp:TextBox ID="companyIdTbe" runat="server" CssClass="form-control"></asp:TextBox>

								<span class="form-label">fornavn:</span>
								<asp:TextBox ID="firstnameTbe" runat="server" CssClass="form-control"></asp:TextBox>

								<span class="form-label">efternavn:</span>
								<asp:TextBox ID="lastnameTbe" runat="server" CssClass="form-control"></asp:TextBox>

								<span class="form-label">Telefon Nummer:</span>
								<asp:TextBox ID="phoneNumberTbe" runat="server" CssClass="form-control"></asp:TextBox>

								<span class="form-label">brugernavn:</span>
								<asp:TextBox ID="usernameTbe" runat="server" CssClass="form-control"></asp:TextBox>

								<span class="form-label">kodeord:</span>
								<asp:TextBox ID="passwordTbe" runat="server" CssClass="form-control"></asp:TextBox>

								<asp:Button CssClass="btn btn-success btn-lg" ID="ButtonEdit" runat="server" Text="Rediger" OnClick="ButtonEdit_Click" />
							
								</ContentTemplate>
							</asp:UpdatePanel>
					</div>
				</div>
			</div>
			<div class="panel panel-default">
				<a data-toggle="collapse" data-parent="#accordion" href="#collapseFour">
					<div class="panel-heading">
						<h4 class="panel-title">Slet Ansat
						</h4>
					</div>
				</a>
				<div id="collapseFour" class="panel-collapse collapse">
					<div class="panel-body">
<%--						<asp:UpdatePanel runat="server" id="updatepanel3" UpdateMode="Conditional">
							<ContentTemplate>
								<Triggers>
									<asp:AsyncPostBackTrigger ControlID="ButtonDeleteHouse" EventName="Click" />
								</Triggers>--%>
						<asp:DropDownList ID="DropDownListDelete" runat="server" CssClass="form-control"></asp:DropDownList>
						<asp:Button CssClass="btn btn-danger" ID="ButtonDeleteHouse" runat="server" Text="Slet Ansat" OnClick="ButtonDelete_Click" />
<%--								</ContentTemplate>
							</asp:UpdatePanel>--%>
					</div>
				</div>
                			<div class="panel panel-default">
				<a data-toggle="collapse" data-parent="#accordion" href="#collapseFive">
					<div class="panel-heading">
						<h4 class="panel-title">Alle Ansatte
						</h4>
					</div>
				</a>
				<div id="collapseFive" class="panel-collapse collapse">
					<div class="panel-body">

						<table class="table table-striped">
							<thead>
								<tr>
									<th>Firma nr</th>
									<th>Fornavn</th>
                                    <th>Efternavn</th>
                                    <th>Telefon nr</th>
                                    <th>Brugernavn</th>
                                    <th>Kodeord</th>
								</tr>
							</thead>
							<tbody>
								<%
                                    List<WebApplication5.Model.Login> lou = pCtr.GetAllEmployee();
									var EmployeeSource = from e in lou
													  select new
													  {
														  e.id,
														  e.companyId,
														  e.firstName,
                                                          e.lastName,
                                                          e.phoneNumber,
                                                          e.userName,
                                                          e.password,
													  };
								%>
								<% foreach (var lo in EmployeeSource.ToList())
		   { %>
								<tr>
									<td><%=lo.companyId%></td>
									<td><%=lo.firstName%></td>
                                    <td><%=lo.lastName%></td>
                                    <td><%=lo.phoneNumber %></td>
                                    <td><%=lo.userName %></td>
                                    <td><%=lo.password %></td>
								</tr>
								<% } %>
							</tbody>
						</table>

					</div>
				</div>
			</div>
			</div>
        </form>

</asp:Content>
